﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ordinaire.Commerce
{
    /// <summary>
    /// Represents detail of an invoice.
    /// </summary>
    public class InvoiceDetail : Entity<int>
    {
        /// <summary>
        /// Gets or sets the data unique identifier of an invoice.
        /// </summary>
        public override int Id
        {
            get { return base.Id; }
            set { base.Id = value; }
        }

        /// <summary>
        /// Gets or sets the good detail.
        /// </summary>
        public Good Good { get; set; }

        /// <summary>
        /// Gets or sets the amount of goods bought or sold.
        /// </summary>
        public decimal Quantity { get; set; }

        /// <summary>
        /// Gets or sets the discount percentage given.
        /// </summary>
        public decimal DiscountPercentage { get; set; }

        /// <summary>
        /// Gets or sets the actual discount given.
        /// </summary>
        public decimal Discount { get; set; }

        /// <summary>
        /// Gets or sets the tax percentage charged for the good.
        /// </summary>
        public decimal TaxPercentage { get; set; }

        /// <summary>
        /// Get or sets the actual tax amount charge for the good.
        /// </summary>
        public decimal Tax { get; set; }

        /// <summary>
        /// Gets or sets the total value of the good.
        /// </summary>
        public virtual decimal Value
        {
            get { return (Good.Value * (decimal) Quantity) + Tax - Discount; }
        }
    }
}
